import interfaceConfig from '../../../api/config/interface'

/**
 * 来电对接列表
 * @param data {}
 */
export const queryCallUrlFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.queryCallUrlFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
/**
 * 获取logo设置
 * @param data {}
 */
export const queryCustomLogo = ({ commit, state, rootState }, data) => {
  return interfaceConfig.queryCustomLogo(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
/**
 * 保存logo设置
 * @param data {}
 */
export const saveCustomLogo = ({ commit, state, rootState }, data) => {
  return interfaceConfig.saveCustomLogo(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
/**
 * 添加对接页面
 * data   name  url  type  outOpenType
 * @param data {}
 */
export const addCallUrlFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.addCallUrlFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
/**
 * 编辑对接页面
 * data   name  url  type  outOpenType
 * @param data {}
 */
export const editCallUrlFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.editCallUrlFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
/**
 * 删除对接页面
 * data   name  url  type  outOpenType
 * @param data {}
 */
export const delCallUrlFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.delCallUrlFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
/**
 * 首页对接列表
 * @param data {}
 */
export const queryInterfaceFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.queryInterfaceFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const addInterfaceFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.addInterfaceFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const editInterfaceFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.editInterfaceFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const delInterfaceFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.delInterfaceFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const moveInterfaceField = ({ commit, state, rootState }, data) => {
  return interfaceConfig.moveInterfaceField(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
/**
 * 客户TAB对接
 * @param data {}
 */
export const queryTABFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.queryTABFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const addTABFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.addTABFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const editTABFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.editTABFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const delTABFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.delTABFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const moveTABField = ({ commit, state, rootState }, data) => {
  return interfaceConfig.moveTABField(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
/**
 * 外呼对接
 * @param data {}
 */
export const queryDialoutUrlFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.queryDialoutUrlFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const addDialoutUrlFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.addDialoutUrlFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const editDialoutUrlFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.editDialoutUrlFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const delDialoutUrlFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.delDialoutUrlFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const userDialoutScreen = ({ commit, state, rootState }, data) => {
  return interfaceConfig.userDialoutScreen(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const stopuserDialoutScreen = ({ commit, state, rootState }, data) => {
  return interfaceConfig.stopuserDialoutScreen(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const updateTokenConfig = ({ commit, state, rootState }, data) => {
  return interfaceConfig.updateTokenConfig(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
  /**
   * 获取通话事件列表
   * @param data {}
   * data.idle ''
   */
export const queryCallEvent = ({commit, state}, data) => {
  return interfaceConfig.queryCallEvent(data)
    .then(response => {
      return response.success && response
    })
    .catch(err => {
      console.error(err)
    })
}
  /**
   * 添加或修改通话事件内容
   * @param data {}
   * data.id '' 添加为'',修改传id
   * data.Name 事件描述
   * data.PBX PBX
   * data.ConcreteType 事件类型
   * data.Url 地址
   */
export const addOrUpdateCallEvent = ({commit, state}, data) => {
  return interfaceConfig.addOrUpdateCallEvent(data)
    .then(response => {
      return response.success && response
    })
    .catch(err => {
      console.error(err)
    })
}
  /**
   * 获取通话事件内容
   * @param data '' 事件id
   */
export const getCallEventById = ({commit, state}, data) => {
  return interfaceConfig.getCallEventById(data)
    .then(response => {
      return response.success && response
    })
    .catch(err => {
      console.error(err)
    })
}
  /**
   * 删除通话事件
   * @param data '' 事件id
   */
export const delCallEvent = ({commit, state}, data) => {
  return interfaceConfig.delCallEvent(data)
    .then(response => {
      return response.success && response
    })
    .catch(err => {
      console.error(err)
    })
}
/**
 * 获取在线咨询对接列表
 * @param data ''
 */
export const channelGetWebChatList = ({commit, state}, data) => {
  return interfaceConfig.channelGetWebChatList(data)
    .then(response => {
      return response.success && response
    })
    .catch(err => {
      console.error(err)
    })
}
/**
 * 添加在线咨询对接
 * @param
 *  "name":"" 名称 "sendUrl":"" 接收消息地址
 *  "toPeer":"10000529" 技能组
 *  "finishCallback":"1" 是否接收结束会话推送
 *  "csrCallback":"1" 是否接收请求满意度评价推送
 */
export const channeladdWebChat = ({commit, state}, data) => {
  return interfaceConfig.channeladdWebChat(data)
    .then(response => {
      return response.success && response
    })
    .catch(err => {
      console.error(err)
    })
}
/**
 * 修改在线咨询对接
 * @param
 *  "name":"" 名称 "sendUrl":"" 接收消息地址
 *  "toPeer":"10000529" 技能组
 *  "finishCallback":"1" 是否接收结束会话推送
 *  "csrCallback":"1" 是否接收请求满意度评价推送
 */
export const channelupdataWebChat = ({commit, state}, data) => {
  return interfaceConfig.channelupdataWebChat(data)
    .then(response => {
      return response.success && response
    })
    .catch(err => {
      console.error(err)
    })
}
/**
 * 删除通话事件
 * @param data '' 事件id
 */
export const channeldelWebChat = ({commit, state}, data) => {
  return interfaceConfig.channeldelWebChat(data)
    .then(response => {
      return response.success && response
    })
    .catch(err => {
      console.error(err)
    })
}

/**
 * 短信对接列表
 * @param data {}
 */
export const querySmsInterfaceFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.querySmsInterfaceFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const addSmsInterfaceFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.addSmsInterfaceFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const editSmsInterfaceFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.editSmsInterfaceFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const delSmsInterfaceFields = ({ commit, state, rootState }, data) => {
  return interfaceConfig.delSmsInterfaceFields(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const moveSmsInterfaceField = ({ commit, state, rootState }, data) => {
  return interfaceConfig.moveSmsInterfaceField(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const queryModuleTabs = ({ commit, state, rootState }, data) => {
  return interfaceConfig.queryModuleTabs(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const showHideTab = ({ commit, state, rootState }, data) => {
  return interfaceConfig.showHideTab(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const saveCustomTab = ({ commit, state, rootState }, data) => {
  return interfaceConfig.saveCustomTab(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const delCustomTab = ({ commit, state, rootState }, data) => {
  return interfaceConfig.delCustomTab(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const queryAutoMoveOutConfig = ({ commit, state, rootState }, data) => {
  return interfaceConfig.queryAutoMoveOutConfig(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
export const updateAutoMoveOutConfig = ({ commit, state, rootState }, data) => {
  return interfaceConfig.updateAutoMoveOutConfig(data)
    .then(response => {
      return response
    })
    .catch(err => {
      console.error(err)
    })
}
